import { _decorator, Component, Node, director } from 'cc';
const { ccclass, property } = _decorator;

export class MyEvent {
    public static CAMERA_ROTATE: string = 'EasyControllerEvent.CAMERA_ROTATE';
    public static MOVEMENT: string = 'EasyControllerEvent.MOVEMENT';
    public static MOVEMENT_STOP: string = 'EasyControllerEvent.MOVEMENT_STOP';
    public static Overturn: string = 'EasyControllerEvent.Overturn';
    public static Overturn_STOP: string = 'EasyControllerEvent.Overturn_STOP';
    public static JUMP: string = 'EasyControllerEvent.JUMP';
}

export class EventController {
    public static on(type: string, callback: Function, target?: any) {
        director.getScene().on(type, callback, target);
    }

    public static off(type: string, callback?: Function, target?: any) {
        director.getScene()?.off(type, callback, target);
    }
}